Skip to content

feat(runner): the authed share round-trip, against the real backend (DEV-2203) - #186

Merged
danielzytohoc merged 12 commits into
masterfrom
feat/DEV-2203-share-create-live
Aug 19, 2026
Merged

feat(runner): the authed share round-trip, against the real backend (DEV-2203)#186
danielzytohoc merged 12 commits into
masterfrom
feat/DEV-2203-share-create-live

Conversation

@danielzytohoc

@danielzytohoc danielzytohoc commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Sixth in the DEV-2203 series. Stacked on #184.

What

e2e/share-create-live.spec.ts — one test, the full authed write path with no stubs: real broker token → Share → real POST /api/demos (BuilderSandbox build, 300 s budget) → /d/:id/ renders for an anonymous client → DELETE in finally410. The revoke is both cleanup and the final assertion, and rows are soft-deleted, so the worst-case leak is one revoked row.

Gate: E2E_BASE_URL and E2E_BROKER_TOKEN (a fresh sessionStorage.hot_token from a signed-in session — documented in AGENTS.md). Broker tokens expire and cannot be minted programmatically; the sustainable machine-auth story is a follow-up ticket, and until then this runs on demand from the e2e-live dispatch, never on a schedule.

Verification

Skip behavior verified (skips without the env pair; asserts the signed-in top bar before acting so an expired token reads as "token expired"). The live path needs a real token — @dan: one manual run with your session token before wiring it into e2e-live would be the proof.

Cost: one BuilderSandbox boot (pool of 3) + one D1 row per run.


Note

Low Risk
Changes are mostly E2E and documented test hooks; production impact is limited to __HOT_FILES__ and aria-label on Style panel rows. The live share spec only runs with secrets and revokes demos in afterEach.

Overview
Live authed share pathe2e/share-create-live.spec.ts runs create → real POST /api/demos build → anonymous /d/:id/ → revoke/410 against a deployed worker, gated on E2E_BASE_URL and E2E_BROKER_TOKEN. Revoke runs in afterEach (not the test finally) so timeouts don’t leave minted shares; demo id is captured from the POST response; the suite waits for starter workspace files before sharing and bumps the test timeout so build/dialog waits can finish.

Style panel E2Ee2e/style-panel.spec.ts covers panel UI, localStorage theme state, codegen output, linked tokens, density variants, themeName round-trip on a docs fixture, reload persistence, “Copy for my app”, unrecognized grid shapes, and Google Fonts — deterministic (stubbed shell, no live bundler) for PR CI.

Test contractsApp.tsx exposes window.__HOT_FILES__() (sync with filesRef, including quiet Style writes) so specs don’t read virtualized CodeMirror. StylePanel.tsx adds aria-label={section.label} on component rows so role queries stay stable when override badges change names.

DocsAGENTS.md documents E2E_BROKER_TOKEN for the share live spec and E2E_AI=1 for live LLM checks.

Reviewed by Cursor Bugbot for commit 1af1719. Bugbot is set up for automated code reviews on this repo. Configure here.

…DEV-2203)

create → build → view → revoke, no stubs: the one test that exercises
the builder, R2 and D1 end to end. Everything else about sharing is
proved with stubbed APIs (authed-actions) or read-only against a fixture
(share-view); nothing walked the write path a deploy could break.

Gated on E2E_BROKER_TOKEN — the worker re-validates every bearer against
the broker and requires @handsontable.com, deliberately, so the token is
a secret someone refreshes by hand when they want the run. The spec
asserts the signed-in top bar before acting, so an expired token reads
as 'token expired', not a dead Share button. One BuilderSandbox boot and
one D1 row per run; the revoke in finally is both the cleanup and the
last assertion (a revoked share answers 410).
Comment thread runner/e2e/share-create-live.spec.ts Outdated
Dan Zyto added 2 commits August 17, 2026 08:34
…#186)

getByLabel(/client link/i) matched both the field and its 'Copy Public
client link' button; strict mode threw before demoId was set, so the
finally never revoked and the minted production share stayed live. The
id now comes from the POST /api/demos response the moment it exists —
no locator can stand between the mint and the cleanup — and the dialog
read narrows to the textbox role, asserting it names the same demo.
@danielzytohoc
danielzytohoc changed the base branch from feat/DEV-2203-engine-and-docs-frameworks to feat/DEV-2203-style-panel-e2e August 17, 2026 06:35
Comment thread runner/e2e/share-create-live.spec.ts Outdated
A visible Fork button proves auth, not content: the workspace starts as
an empty placeholder and fills asynchronously — and can refill when
/api/versions swaps in latest. Sharing in that window posts empty files
and burns the whole 300s dialog budget on a doomed build. The test now
waits for /package.json to exist in the files map first.
@danielzytohoc
danielzytohoc requested a review from demtario August 18, 2026 09:21
Comment thread runner/e2e/share-create-live.spec.ts Outdated
Base automatically changed from feat/DEV-2203-style-panel-e2e to master August 19, 2026 07:53
Dan Zyto added 2 commits August 19, 2026 09:57
…eadroom (Bugbot #186)

test.setTimeout(420s) equalled the sum of the wait ceilings exactly
(30+30+300+60), so a build that used its whole dialog budget timed the
body out before the view assertions — and a timed-out body is killed
mid-flight, finally included, leaving the minted production share alive.
The revoke (and its 410 assertion) moves to an afterEach with its own
60s timeout slice, which runs even when the body dies; the body budget
rises to 480s. No sleeps anywhere — every wait stays condition-bound
with a ceiling.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1af1719. Configure here.

Comment thread runner/e2e/share-create-live.spec.ts
danielzytohoc pushed a commit that referenced this pull request Aug 19, 2026
The wire capture is un-awaited and its json read best-effort — if it
lost the race, a demo existed (the dialog was showing its link) while
afterEach saw null and skipped the revoke. The dialog link's id is now
the recovery path: demoId ??= linkId before any assertion can throw,
and the two sources are asserted to agree when both answered.
@danielzytohoc
danielzytohoc merged commit 3727e2c into master Aug 19, 2026
7 checks passed
@danielzytohoc
danielzytohoc deleted the feat/DEV-2203-share-create-live branch August 19, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants